<script setup lang="ts">
import { onMounted } from 'vue';
import { storeToRefs } from 'pinia';
import { sessionCryptoCache } from '@/utils/cryptoCache';
import useThemeConfig from '@/stores/themeConfig';

const stores = useThemeConfig();
const { themeConfig } = storeToRefs(stores);

// 页面加载时
onMounted(() => {
	const themeConfigStyle = sessionCryptoCache.getItem('themeConfigStyle');
	// 获取缓存中的样式配置
	if (themeConfigStyle) {
		document.documentElement.style.cssText = themeConfigStyle;
	}
	// 监听布局配置弹窗点击打开
	if (!themeConfig.value.isDrawer) {
		themeConfig.value.isDrawer = true;
	}
});
</script>

<template>
	<router-view />
</template>
